from google.appengine.ext import db

class MoiKrugUser(db.Model):
  moi_krug_id = db.IntegerProperty(required=True)
  full_name = db.StringProperty(required=True)
  home_page = db.StringProperty(required=True)

def getByMoiKrugId(moi_krug_id):
  return MoiKrugUser.all().filter('moi_krug_id = ', moi_krug_id).get()

def addOrUpdate(moi_krug_id, full_name, home_page):
  user = getByMoiKrugId(moi_krug_id)
  if not user:
    user = MoiKrugUser(moi_krug_id=moi_krug_id,
                       full_name=full_name,
                       home_page=home_page)
    user.put()
